#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
#define K 100006
int arr[K];
int tmp[K]={0};
int i = 0;


int hhh(int n)
{
	tmp[0] = 0;
	int tmp_i = 0;
	int arr_i = n - 1;
	int num= n;
	tmp[tmp_i] = arr[arr_i];
	for (i = 0; i < 2 * n; i++)
	{
		if (arr_i < 0||num==0) break;
		
		if (tmp[tmp_i] == num&&tmp_i>=0)
		{
			num--;
			tmp_i--;
		}
		else
		{
			arr_i--;
			tmp_i++;
			tmp[tmp_i] = arr[arr_i];
		}
		
	}
	//printf("%d", num);
	if (num == 0) return 1;
	else return 0;

}


int main()
{
	
	int T;
	scanf("%d", &T);
	while (T--)
	{
		memset(tmp, 0, sizeof(tmp));
		int n;
		scanf("%d",&n);
		for (i = 0; i < n; i++)
		{
			scanf("%d", &arr[i]);
		}

		int result=hhh(n);
		if (result == 1||n==1)
			printf("Yes\n");
		else
			printf("N0\n");
	}
	return 0;
}